# from WoniuBossPOM.Employ_Management_POM_SHL import Employ_ManageMent_POM_SHL
import time
from Base.PublicFunction import OpenBroswer
from selenium.webdriver.support.select import Select
from WoniuBossPOM.All_Management_POM import All_Mamagement


class Employ_Management:
    def __init__(self):
        self.dr=All_Mamagement()

    #
    # def login(self,username,passwd):
    #     self.dr.getusername().send_keys(username)
    #     self.dr.getpassword().send_keys(passwd)
    #     self.dr.getlogin().click()

    def add_company(self,company,industry,address,name,phone):
        self.dr.click_jiuye().click()    #点击就业管理
        self.dr.click_client().click()     #点击企业客户
        self.dr.click_add_company().click()     #点击新增企业
        self.dr.get_company_name().send_keys(company)
        self.dr.get_industry().send_keys(industry)
        self.dr.get_address().send_keys(address)
        self.dr.get_contacts().send_keys(name)
        self.dr.get_phone().send_keys(phone)
        self.dr.click_add().click()

    def search_company(self,city,class_name,direction):             #搜索入职信息
        self.dr.click_jiuye().click()       #点击就业管理
        self.dr.click_entry_information().click()      #点击入职信息
        selectlist=Select(self.dr.click_select_range())     #点击区域的下拉框
        selectlist.select_by_visible_text(city)      #选择成都
        selectlist = Select(self.dr.click_select_class())    #点击班级的下拉框
        selectlist.select_by_visible_text(class_name)    #选择29期的班级
        selectlist=Select(self.dr.click_select_direction())    #点击测试方向的下拉框
        selectlist.select_by_visible_text(direction)      #选择测试
        self.dr.click_search_entry_information().click()

    def add_join_company(self,city,class_name,direction,person_positon,salary,company_name):
        self.dr.click_jiuye().click()  # 点击就业管理
        self.dr.click_entry_information().click()  # 点击入职信息
        selectlist = Select(self.dr.click_select_range())  # 点击区域的下拉框
        selectlist.select_by_visible_text(city)  # 选择成都
        selectlist = Select(self.dr.click_select_class())  # 点击班级的下拉框
        selectlist.select_by_visible_text(class_name)  # 选择29期的班级
        selectlist = Select(self.dr.click_select_direction())  # 点击测试方向的下拉框
        selectlist.select_by_visible_text(direction)  # 选择测试
        self.dr.click_add_join().click()      #点击新增的按钮
        selectlist=Select(self.dr.get_joinposition())   #点击入职岗位的下拉框
        selectlist.select_by_visible_text(person_positon)    #选择测试工程师
        time.sleep(2)
        self.dr.get_joindata().click()      #点击选择时间的下拉框
        self.dr.get_detail_time().click()   #点击选择的时间
        self.dr.get_salary().send_keys(salary)    #薪水多少钱
        self.dr.get_select_company().click() #点击选择公司的下拉框
        self.dr.get_input().send_keys(company_name)     #点击输入企业名称
        self.dr.click_input().click()         #点击企业名称确认
        self.dr.click_save().click()   #保存

    
















if __name__ == '__main__':
    run=Employ_Management()
    # run.login("WNCD000","woniu123")
    # run.add_company("上海有机农业有限公司","农业","上海市浦东新区张东路99号","赵小姐","159857457454")
    # run.search_company("成都","WNCDC_2901","测试")
    run.add_join_company("成都","WNCDC_2901","测试","测试工程师","15000","阿里巴巴")
